package day09.HashMapTest;

import java.util.HashMap;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        //字符串中每种字符出现的数量
        //abcabcabc
        System.out.println("请输入字符串:");
        String s = new Scanner(System.in).nextLine();
        HashMap<Character, Integer> map = new HashMap<>();
        for(int i = 0; i < s.length(); i++){
            char c = s.charAt(i);
            Integer count = map.get(c);
            if(count == null){
                map.put(c, 1);
            }else{
                map.put(c, count+1);
            }

        }
        System.out.println(map);
    }
}
